package com.woniuxy.juc;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO:
 * <P> Date: 2022/4/8:20:58
 * <P> Description:
 */

public class DCLTest {
    private static DCLTest dclTest;

    private DCLTest() {}

    public static  DCLTest getInstance() {
        if (dclTest == null) {
            synchronized (DCLTest.class) {
                if (dclTest == null) {
                    dclTest = new DCLTest();
                }
            }
        }
        return dclTest;
    }

    /**
        * TODO:使用静态内部类实现安全的懒加载
    **/
    private static class Singleton {
        private static final Singleton SINGLETON = new Singleton();
    }

    public static Singleton getSingleton(){
        return Singleton.SINGLETON;
    }
}
